
package com.bamboocloud.im.simpleConnector.simpleConnector;

import org.identityconnectors.common.Assertions;
import org.identityconnectors.common.StringUtil;
import org.identityconnectors.common.security.GuardedString;
import org.identityconnectors.framework.spi.AbstractConfiguration;
import org.identityconnectors.framework.spi.ConfigurationProperty;


/**
 * Extends the {@link AbstractConfiguration} class to provide all the necessary
 * parameters to initialize the simpleConnector Connector.
 *
 */
public class simpleConnectorConfiguration extends AbstractConfiguration {


    // Exposed configuration properties.

    /**
     * The connector to connect to.
     */
    private String host;

    /**
     * The Remote user to authenticate with.
     */
    private String remoteUser = null;

    /**
     * The Password to authenticate with.
     */
    private GuardedString password = null;
    
    private String userCreateUrl = null;
    
    private String userUpdateUrl = null;
    
    private String userDeleteUrl = null;
    
    private String queryUserByIdUrl = null;
    
    private String queryAllUserIdsUrl = null;
    
    private String orgCreateUrl = null;
    
    private String orgUpdateUrl = null;
    
    private String orgDeleteUrl = null;
    
    private String queryOrgByIdUrl = null;
    
    private String queryAllOrgIdsUrl = null;

    private String schemaServiceUrl = null;
    


    /**
     * Constructor.
     */
    public simpleConnectorConfiguration() {

    }


    @ConfigurationProperty(order = 1, displayMessageKey = "host.display",
            groupMessageKey = "basic.group", helpMessageKey = "host.help",
            required = true, confidential = false)
    public String getHost() {
        return host;
    }

    public void setHost(String host) {
        this.host = host;
    }


    @ConfigurationProperty(order = 2, displayMessageKey = "remoteUser.display",
            groupMessageKey = "basic.group", helpMessageKey = "remoteUser.help",
            required = true, confidential = false)
    public String getRemoteUser() {
        return remoteUser;
    }

    public void setRemoteUser(String remoteUser) {
        this.remoteUser = remoteUser;
    }

    @ConfigurationProperty(order = 3, displayMessageKey = "password.display",
            groupMessageKey = "basic.group", helpMessageKey = "password.help",
            confidential = true,required = true)
    public GuardedString getPassword() {
        return password;
    }

    public void setPassword(GuardedString password) {
        this.password = password;
    }

    
   @ConfigurationProperty(order = 4, displayMessageKey = "userCreateUrl.display",
   			groupMessageKey = "basic.group", helpMessageKey = "userCreateUrl.help", required = true)
    public String getUserCreateUrl() {
		return userCreateUrl;
	}


	public void setUserCreateUrl(String userCreateUrl) {
		this.userCreateUrl = userCreateUrl;
	}


	@ConfigurationProperty(order = 5, displayMessageKey = "userUpdateUrl.display",
			groupMessageKey = "basic.group", helpMessageKey = "userUpdateUrl.help", required = true)
	public String getUserUpdateUrl() {
		return userUpdateUrl;
	}


	public void setUserUpdateUrl(String userUpdateUrl) {
		this.userUpdateUrl = userUpdateUrl;
	}


	@ConfigurationProperty(order = 6, displayMessageKey = "userDeleteUrl.display",
			groupMessageKey = "basic.group", helpMessageKey = "userDeleteUrl.help", required = true)
	public String getUserDeleteUrl() {
		return userDeleteUrl;
	}


	public void setUserDeleteUrl(String userDeleteUrl) {
		this.userDeleteUrl = userDeleteUrl;
	}

	@ConfigurationProperty(order = 7, displayMessageKey = "queryUserByIdUrl.display",
			groupMessageKey = "basic.group", helpMessageKey = "queryUserByIdUrl.help")
	public String getQueryUserByIdUrl() {
		return queryUserByIdUrl;
	}


	public void setQueryUserByIdUrl(String queryUserByIdUrl) {
		this.queryUserByIdUrl = queryUserByIdUrl;
	}

	@ConfigurationProperty(order = 8, displayMessageKey = "queryAllUserIdsUrl.display",
			groupMessageKey = "basic.group", helpMessageKey = "queryAllUserIdsUrl.help")
	public String getQueryAllUserIdsUrl() {
		return queryAllUserIdsUrl;
	}


	public void setQueryAllUserIdsUrl(String queryAllUserIdsUrl) {
		this.queryAllUserIdsUrl = queryAllUserIdsUrl;
	}

	@ConfigurationProperty(order = 9, displayMessageKey = "orgCreateUrl.display",
			groupMessageKey = "basic.group", helpMessageKey = "orgCreateUrl.help")
	public String getOrgCreateUrl() {
		return orgCreateUrl;
	}


	public void setOrgCreateUrl(String orgCreateUrl) {
		this.orgCreateUrl = orgCreateUrl;
	}

	@ConfigurationProperty(order = 10, displayMessageKey = "orgUpdateUrl.display",
			groupMessageKey = "basic.group", helpMessageKey = "orgUpdateUrl.help")
	public String getOrgUpdateUrl() {
		return orgUpdateUrl;
	}


	public void setOrgUpdateUrl(String orgUpdateUrl) {
		this.orgUpdateUrl = orgUpdateUrl;
	}

	@ConfigurationProperty(order = 11, displayMessageKey = "orgDeleteUrl.display",
			groupMessageKey = "basic.group", helpMessageKey = "orgDeleteUrl.help")
	public String getOrgDeleteUrl() {
		return orgDeleteUrl;
	}


	public void setOrgDeleteUrl(String orgDeleteUrl) {
		this.orgDeleteUrl = orgDeleteUrl;
	}

	@ConfigurationProperty(order = 12, displayMessageKey = "queryOrgByIdUrl.display",
			groupMessageKey = "basic.group", helpMessageKey = "queryOrgByIdUrl.help")
	public String getQueryOrgByIdUrl() {
		return queryOrgByIdUrl;
	}


	public void setQueryOrgByIdUrl(String queryOrgByIdUrl) {
		this.queryOrgByIdUrl = queryOrgByIdUrl;
	}

	@ConfigurationProperty(order = 13, displayMessageKey = "queryAllOrgIdsUrl.display",
			groupMessageKey = "basic.group", helpMessageKey = "queryAllOrgIdsUrl.help")
	public String getQueryAllOrgIdsUrl() {
		return queryAllOrgIdsUrl;
	}


	public void setQueryAllOrgIdsUrl(String queryAllOrgIdsUrl) {
		this.queryAllOrgIdsUrl = queryAllOrgIdsUrl;
	}

	@ConfigurationProperty(order = 14, displayMessageKey = "schemaServiceUrl.display",
			groupMessageKey = "basic.group", helpMessageKey = "schemaServiceUrl.help", required = true)
	public String getSchemaServiceUrl() {
		return schemaServiceUrl;
	}

	public void setSchemaServiceUrl(String schemaServiceUrl) {
		this.schemaServiceUrl = schemaServiceUrl;
	}

	/**
     * {@inheritDoc}
     */
    public void validate() {
        if (StringUtil.isBlank(host)) {
            throw new IllegalArgumentException("Host cannot be null or empty.");
        }

        Assertions.blankCheck(remoteUser, "remoteUser");

        Assertions.nullCheck(password, "password");
    }


}
